from django.contrib.auth.models import Permission, ContentType
from rest_framework import serializers


class PermissionSerializer(serializers.ModelSerializer):
    """ 用户权限 模型类序列化器"""

    class Meta:
        model = Permission
        fields = ["id", "name", "codename", "content_type"]


class ContentTypeSerializer(serializers.ModelSerializer):
    """ 权限类型 模型类序列化器"""

    class Meta:
        model = ContentType
        fields = ["id", "name"]
